summaryrefslogtreecommitdiffstats
path: root/typescript/src/getAjaxResponse.ts
blob: 14591145b882b6d755df5ae87f128316d90eaa7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* SPDX-License-Identifier: AGPL-3.0-or-later */

import AjaxResponse from "./AjaxResponse.js";
import type AjaxSettings from "./AjaxSettings.js";

export default async (AjaxSettings: AjaxSettings): Promise<AjaxResponse> => {
  try {
    Object.freeze(AjaxSettings);

    // npm i @types/jquery
    return Object.freeze(await jQuery.ajax(AjaxSettings));
  } catch (error) {
    console.warn({ error });
    return {};
  }
};